package nz.net.pole.util;

/**
 * An exception used to indicate that an illegal name has been passed to a method accepting only valid name strings.
 * @author James Pole (james@pole.net.nz)
 */
public class IllegalNameException extends IllegalArgumentException {

    /**
     * Creates an instance with the given invalid name, minimum length for the name and maximum length for the name.
     * Using this constuctor implies that the error occured due to an invalid string length. It will automatically
     * generate the exception message "<i>The name '<b>$name</b>' was invalid. Length of the name should be between
     * <b>$minimumLength</b> and <b>$maximumLength</b> inclusive.</i>".
     *
     * @param name The name that was proposed.
     * @param minimumLength The minimum length of the name.
     * @param maximumLength The maximum length of the name.
     */
    public IllegalNameException(String name, int minimumLength, int maximumLength) {

        super("The name '" + name + "' was invalid. Length of the name should be between " + minimumLength + " and " + maximumLength + " inclusive.");

    }
}
